Repository navigation
Conversation
对齐上游 pi 的 per-request 模型解析语义:/model 与 /thinking 切换后不再 等到本轮结束,而是在每次新的 Provider 请求前由 prepare-request 钩子解析 最新选择并派生完整 effective-cfg,立即作用于续轮、steering、follow-up 与 下一条普通消息。 Agent / Code 层 - agent/loop.scm:pi-step-agent-turn 在请求边界调用可选 prepare-request, 返回的 effective-cfg 用于 provider、request-fn 与费用计算;未配置钩子 时沿用原 cfg,CLI/测试/非交互调用行为不变。 - code/modes/flow.scm:普通 Provider 与 all-in-one 分发改为按本次 effective-cfg 的 provider 动态判断,运行中在普通模型与 all-in-one 之间切换也走正确适配器。 - code/core/compaction/flow.scm:compactor 执行时同样解析最新 effective-cfg, 压缩窗口/认证不再固定为创建闭包时的初始模型。 TUI 状态与发布链路 - state.scm:新增 request-selection-chan 字段,删除 pending-model-switch。 - app.scm:创建并传入 request-selection-chan,启动 worker 时一并传递。 - 新增 app-selection.scm:集中 latest-wins 发布辅助,/model 与 /thinking 共用, 避免互相覆盖;发布失败以错误卡片提示,不静默吞掉。 - app-model.scm:/model 无论 busy/idle 都立即更新界面并发布选择快照, 提示卡片改为 "Model: ..." / "Default model: ...",删除延迟切换逻辑。 - app-thinking.scm:显式 /thinking 修改后发布当前完整快照,避免被较早的 /model 快照覆盖。 - app-events.scm:删除 agent_settled/error 时的补发"已经切换到"逻辑。 Worker 与上下文窗口 - 新增 worker-model.scm:effective-cfg 容器与 prepare-request 构造器, 排空通道、latest-wins、跨 provider 执行 augment、同步 thinking 与显式标志。 - worker.scm:贯穿 Worker 生命周期持有 effective-cfg,消息任务接入 prepare-request; 非消息任务(落盘/统计/resume/reload)不误清当前模型选择。 - worker-emit.scm:make-tui-emit 支持数字窗口与动态 getter;all-in-one 实际节点 窗口仅作用于本次请求,agent_settled 时清除,避免污染普通模型。 Footer 清理 - footer.scm / footer-model.scm:删除 pending-from 字段及双段展示, pi-footer-set-active-node! 恢复只维护 all-in-one 实际节点。 测试 - 新增 run-agent-loop-model-switch-test、pi-worker-prepare-request-test、 pi-worker-model-switch-test、pi-app-publish-request-selection-bang-test、 pi-app-request-selection-chan-test。 - 更新 pi-step-agent-turn、pi-app-submit-model、pi-app-model-session-state、 pi-app-submit-thinking、pi-footer-right-part、run-agent-loop-with-timeout、 pi-make-compaction-option 等回归。 - 删除只服务于延迟切换语义的 pending-model 测试。 全部通过 gf test agent/code/tui (120+585+512)、gf fmt --check、gf check。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
对齐上游 pi 的
prepareRequest语义:/model与/thinking切换后不再等到本轮结束,而是在每次新的 Provider 请求前由prepare-request钩子解析最新选择并派生完整 effective-cfg,立即作用于续轮、steering、follow-up 与下一条普通消息。详细规划见 `plan.md`(commit d2bc6b7)。
改动
Agent / Code 层
TUI 状态与发布链路
Worker 与上下文窗口
Footer 清理
测试
验收
```bash
gf test agent/tests/liii # 120 passed
gf test code/tests/liii # 585 passed
gf test tui/tests/liii # 512 passed
gf fmt --check agent code tui # OK
gf check # all OK
```
行为验收: